package com.meida.module.bus.provider.controller;

import com.meida.common.mybatis.model.ResultBody;
import com.meida.common.springmvc.base.BaseController;
import com.meida.module.bus.client.entity.BusReportOutfour;
import com.meida.module.bus.provider.service.BusReportOutfourService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;


/**
 * 对外验工月报四控制器
 *
 * @author flyme
 * @date 2020-11-17
 */
@RestController
@RequestMapping("/bus/reportOutfour/")
public class BusReportOutfourController extends BaseController<BusReportOutfourService, BusReportOutfour>  {

    @ApiOperation(value = "对外验工月报四-分页列表", notes = "对外验工月报四分页列表")
    @GetMapping(value = "page")
    public ResultBody pageList(@RequestParam(required = false) Map params) {
        return bizService.pageList(params);
    }

    @ApiOperation(value = "对外验工月报四-分页列表", notes = "对外验工月报四分页列表")
    @GetMapping(value = "common/page")
    public ResultBody pageList1(@RequestParam(required = false) Map params) {
        return bizService.pageList(params);
    }

    @ApiOperation(value = "对外验工月报四-列表", notes = "对外验工月报四列表")
    @GetMapping(value = "list")
    public ResultBody list(@RequestParam(required = false) Map params) {
        return bizService.listEntityMap(params);
    }

    @ApiOperation(value = "对外验工月报四-添加", notes = "添加对外验工月报四")
    @PostMapping(value = "save")
    public ResultBody save(@RequestParam(required = false) Map params) {
        return bizService.add(params);
    }

    @ApiOperation(value = "对外验工月报四-更新", notes = "更新对外验工月报四")
    @PostMapping(value = "update")
    public ResultBody update(@RequestParam(required = false) Map params) {
        return bizService.edit(params);
    }

    @ApiOperation(value = "对外验工月报四-删除", notes = "删除对外验工月报四")
    @PostMapping(value = "remove")
    public ResultBody remove(@RequestParam(required = false) Map params) {
        return bizService.delete(params);
    }


    @ApiOperation(value = "对外验工月报四-详情", notes = "对外验工月报四详情")
    @GetMapping(value = "get")
    public ResultBody get(@RequestParam(required = false) Map params) {
        return bizService.get(params);
    }

    @ApiOperation(value = "对外月报4-导入数据", notes = "对外月报4-导入数据")
    @PostMapping(value = "importReportOutOneData")
    public ResultBody importReportOutOneData(@RequestParam(required = false) Map params, @RequestParam("file") MultipartFile file) {
        ResultBody resultBody = bizService.importBusReportOutfourdata(file, params);
        return resultBody;
    }
    @ApiOperation(value = "对外月报4-导出数据", notes = "对外月报1-导出数据")
    @PostMapping(value = "exportData")
    public void exportTemplate(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) Map params) {
        bizService.export(params, request, response, "对外月报4", null, "busReportOutfourExportHandler");
    }

}
